<template>
	<view>
		<view class="head">
			<view class="head_left" @tap="back()">
				<image src="../../../static/wode/return.png" mode=""></image>
			</view>
			<view class="head_mid">
				我的认证
			</view>
			<view class="head_left">

			</view>
		</view>
		<view class="margin-box">
			<view class="body_item" @tap="torealName">
				<view class="item_left">
					<image src="../../../static/wode/realName.png" mode=""></image>
					<text>实名认证</text>
				</view>
				<view class="item_right">
					<image v-if="realState.status==1" class="yirenzheng" src="../../../static/wode/yirenzheng.png" mode=""></image>
					<image v-else-if="realState.status==2" class="shenhe" src="../../../static/wode/daishenhe.png" mode=""></image>
					<image v-else-if="realState.status==3" class="yirenzheng" src="../../../static/wode/jujue.png" mode=""></image>
					<image class="right" src="../../../static/right.png" mode=""></image>
				</view>
			</view>
			<view class="body_item" @tap="toshenfen">
				<view class="item_left">
					<image src="../../../static/wode/shenfen.png" mode=""></image>
					<text>身份认证</text>
				</view>
				<view class="item_right">
					<text>{{overseasState.identity}}</text>
					<!-- <image class="yirenzheng" src="../../../static/wode/yirenzheng.png" mode=""></image> -->
					<image v-if="overseasState.status==1" class="yirenzheng" src="../../../static/wode/yirenzheng.png" mode=""></image>
					<image v-else-if="overseasState.status==2" class="shenhe" src="../../../static/wode/daishenhe.png" mode=""></image>
					<image v-else-if="overseasState.status==3" class="yirenzheng" src="../../../static/wode/jujue.png" mode=""></image>
					<image class="right" src="../../../static/right.png" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				realState: '', //实名认证信息
				overseasState: '', //境外认证信息
			};
		},
		onShow() {
			this.getState()
			this.getrealState()
		},
		methods: {
			torealName() {
				uni.navigateTo({
					url: '../realName/realName?realStatus=' + this.realState.status
				})
			},
			toshenfen() {
				uni.navigateTo({
					url: '../shenfen/shenfen'
				})
			},
			back() { //返回
				uni.navigateBack({
					delta: 1
				})
			},
			getrealState() {
				var me = this;
				var data = {
					user_id: uni.getStorageSync('user_id'),
				}
				this.myAjaxNew({
					model: 'user',
					controllerName: 'userIdentity',
					actionName: 'query',
					data: data,
					successBack: function(res) {
						// console.log(res, '实名认证信息')
						if (res.data.data !== null && res.data.data.length != 0) {
							me.realState = res.data.data[0]
						}
					}
				})
			},
			getState() {
				var me = this;
				var data = {
					user_id: uni.getStorageSync('user_id'),
				}
				this.myAjaxNew({
					model: 'user',
					controllerName: 'overseasIdentity',
					actionName: 'query',
					data: data,
					successBack: function(res) {
						console.log(res.data.data, '境外认证信息')
						if (res.data.data !== null && res.data.data.length != 0) {
							for (var i = 0; i < res.data.data.length; i++) {
								if (res.data.data[i].status == 1) {
									me.overseasState = res.data.data[i]

									switch (me.overseasState.identity_type) {
										case 'overseas_student':
											me.overseasState.identity = '留学生';
											break;
										case 'overseas_chinese':
											me.overseasState.identity = '华侨';
											break;
										case 'ethnic_chinese':
											me.overseasState.identity = '华裔';
											break;
										case 'overseas_staff':
											me.overseasState.identity = '境外工作';
											break;
										case 'overseas_nationality' :
											me.overseasState.identity = '国籍';
											break;
										case 'overseas_merchant' :
											me.overseasState.identity = '境外商人';
											break;
										case 'student' :
											me.overseasState.identity = '学生';
											break;
										default:
											break;
									}
								}
							}
						}
					}
				})
			},
		}
	}
</script>

<style scoped>
	.head {
		width: 100%;
		display: flex;
		justify-content: space-between;
		height: 162upx;
		background: #ffffff;
		padding: 0 24upx;
		z-index: 200;
		position: fixed;
		top: 0;
		box-sizing: border-box;
	}

	.head image {
		width: 20upx;
		height: 36upx;
		margin-right: 9upx;
	}

	.head_left {
		height: 82upx;
		width: 106upx;
		display: flex;
		align-items: center;
		line-height: 82upx;
		color: #666666;
		font-size: 32upx;
		padding-top: 70upx;
	}

	.head_mid {
		padding-top: 90upx;
	}

	.head_right {
		width: 150upx;
	}

	.margin-box {
		padding-top: 182upx;
	}

	.body_item {
		width: 660upx;
		height: 114upx;
		background: rgba(255, 255, 255, 1);
		box-shadow: 0upx 12upx 27upx 3upx rgba(0, 205, 206, 0.5);
		border-radius: 10upx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		/* padding: 24upx; */
		text-align: center;
		margin: 0 auto;
		margin-bottom: 20upx;
		padding: 0 24upx;

	}

	.item_left,
	.item_right {
		display: flex;
		align-items: center;
	}

	.item_left image {
		width: 44upx;
		height: 44upx;
		margin-right: 10upx;
	}

	.item_left {
		color: #47CECF;
		font-size: 32upx;
	}

	.item_right text {
		color: #999999;
		font-size: 28upx;
		margin-right: 26upx;
	}

	.yirenzheng {
		width: 88upx;
		height: 77upx;
	}

	.shenhe {
		width: 90upx;
		height: 30upx;
	}

	.right {
		width: 16upx;
		height: 28upx;
		margin-left: 58upx;
	}

	.body_bottom {
		background: #FFFFFF;
		margin-top: 20upx;
	}

	.item_title {
		color: #333333;
		font-size: 32upx;
		height: 88upx;
		border-bottom: 1upx solid #E6E6E6;
		padding: 0 24upx;
	}

	.item {
		height: 88upx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: 1upx solid #e6e6e6;
		color: #666666;
		font-size: 32upx;
		padding: 0 24upx;
	}

	.item image {
		width: 16upx;
		height: 28upx;
	}
</style>
